<template>
  <div class="member">
    <el-card>
      <Forms ref="refForms" :dialog="dialog" @refreshList="refreshList"></Forms>
      <Lists
        :dialog="dialog"
        :seckListData="seckListData"
        @editSeckill="editSeckill"
        @refreshList="refreshList"
      ></Lists>
    </el-card>
  </div>
</template>

<script>
import { getSeckList } from "../../request/api";
import Forms from "./component/Forms.vue";
import Lists from "./component/Lists.vue";
export default {
  components: { Forms, Lists },
  data() {
    return {
      dialog: {
        isShowDialog: false,
      },
      // 秒杀活动数据
      seckListData: [],
    };
  },
  methods: {
    // 获取秒杀活动列表数据
    getSeckListData() {
      getSeckList().then(
        (res) => {
          if (res.data.code == 200) {
            this.seckListData = res.data.list;
          }
        },
        (err) => err
      );
    },
    // 刷新列表
    refreshList() {
      this.getSeckListData();
    },
    editSeckill(id) {
      this.$refs.refForms.getOneSeckillData(id);
    },
  },
  mounted() {
    this.getSeckListData();
  },
};
</script>

<style>
</style>